<form method="post" action="<?= site_url('utama/proses_update_proyek')?>" class="validate" novalidate="novalidate">
	<div id="main_content" style="min-height: 600px">
		<div class="grid_6" style="margin-right: 50%">
			<div class="box">
				<div class="header">
					<h3>
						Edit Proyek
					</h3>
				</div>
				<div class="content no-padding with-actions">
					<div class="section _100">
						<label for="nama_proyek">
							Nama Proyek
						</label>
						<div>
							<input maxlength="45" class="required" name="nama_proyek" id="nama_proyek" value="<?= $proyek['nama_proyek'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="pemilik_proyek">
							Pemilik Proyek
						</label>
						<div>
							<input maxlength="45" class="required" name="pemilik_proyek" id="pemilik_proyek" value="<?= $proyek['pemilik_proyek'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="penanggung_jawab">
							Penanggung Jawab
						</label>
						<div>
							<input maxlength="45" class="required" name="penanggung_jawab" id="penanggung_jawab" value="<?= $proyek['penanggung_jawab'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="total_dana">
							Total Dana
						</label>
						<div>
							<input class="required digits" name="total_dana" id="total_dana" value="<?= $proyek['total_dana'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="tanggal_mulai">
							Tanggal Mulai
						</label>
						<div>
							<input class="required dateISO" name="tanggal_mulai" id="tanggal_mulai" value="<?= $proyek['tanggal_mulai'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="tanggal_deadline">
							Tanggal Deadline
						</label>
						<div>
							<input class="required dateISO" name="tanggal_deadline" id="tanggal_deadline" value="<?= $proyek['tanggal_deadline'] ?>"/>
						</div>
					</div>
					<div class="section _100">
						<label for="pegawai_terlibat">
							Pegawai Terlibat
						</label>
						<div>
							<?php
							$ketemu = false;
							foreach ($daftar_pegawai as $row) {
								foreach ($pegawai_proyek as $value) {
									if ($value == $row['idPegawai']) {
										echo "<div class=_50>";
										echo "<p>";
										echo "<label>";
										echo form_checkbox('idPegawai[]', $row['idPegawai'], true);
										echo $row['nama_pegawai'];
										echo "</label>";
										echo "</p>";
										echo "</div>";
										$ketemu = true;
										break 1;
									}
								}
								if (!$ketemu) {
									echo "<div class=_50>";
									echo "<p>";
									echo "<label>";
									echo form_checkbox('idPegawai[]', $row['idPegawai'], false);
									echo $row['nama_pegawai'];
									echo "</label>";
									echo "</p>";
									echo "</div>";
								}
								$ketemu = false;
							}
							?>
						</div>
					</div>
					<div class="section _100">
						<label for="status">
							Status
						</label>
						<div>
							<?php
								$options = array('dikerjakan' => 'Dikerjakan', 'selesai' => 'selesai');
								echo form_dropdown('status', $options, $proyek['status']); ?>
						</div>
					</div>
					<input type="hidden" name="idRuangProyek" value="<?= $proyek['idRuangProyek']?>" />
					<div class="actions">
						<div class="actions-left">
							<input name="submit_update_proyek" type="submit" value="Simpan"/>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</form>
<script type="text/javascript">
	$(function(){
		$("#tanggal_mulai").datepicker({dateFormat:'yy-mm-dd'});
	});

	$(function(){
		$("#tanggal_deadline").datepicker({dateFormat:'yy-mm-dd'});
	});
</script>
</script>
<script type="text/javascript">
	//<![CDATA[
    $(window).load(function () {
		var a = $("form").validate({
			invalidHandler: function (d, b) {
				var e = b.numberOfInvalids();
				if (e) {
					var c = e == 1 ? "Anda hanya mengisi 1 field, field kosong telah ditandai" : "Anda tidak mengisi " + e + " fields. Field tersebut telah ditandai.";
					$(".box .content").removeAlertBoxes();
					$(".box .content").alertBox(c, {
						type: "warning",
						icon: true,
						noMargin: false
					});
					$(".box .content .alert").css({
						width: "",
						margin: "0",
						borderLeft: "none",
						borderRight: "none",
						borderRadius: 0
					})
				} else {
					$(".box .content").removeAlertBoxes()
				}
			},
			showErrors: function (c, d) {
				this.defaultShowErrors();
				var b = this;
				$.each(d, function () {
					var f = $(this.element);
					var e = f.parent().find("label.error").hide();
					e.addClass("red");
					e.css("width", "");
					f.trigger("labeled");
					e.fadeIn()
				})
			},
			submitHandler: function (b) {
				$("form").submit();
			}
		})
	});
    //]]>
</script>